﻿using System.Collections.Generic;
using System.Linq;
using DevFramework.Core.DataAccess.NHibernate;
using DevFramework.DataLayer.Abstract;
using DevFramework.DataLayer.Concrete.NHibernate.Helper;
using DevFramework.Entities.Concrete;
using NHibernate.Linq;

namespace DevFramework.DataLayer.Concrete.NHibernate
{
    public class NhVProductDal : IVProductDal
    {
        private readonly NHibernateHelper _helper;

        public NhVProductDal(NHibernateHelper helper)
        {
            _helper = helper;
        }

        public List<VProduct> GetAll()
        {
            using (var session = _helper.OpenSession())
            {
                return session.Query<VProduct>().ToList();
            }
        }
    }
}
